<?php

abstract class Base_View extends Base_Base
{
	private $_path;
	private $_outputVars = array();
	public function __construct(Base_Path $path)
	{
		$this->_path = $path;
	}
    public function __toString()
    {
    	$r = '';
    	if (file_exists($templateFile = $this->_customName().'/template/'.$this->_path[0].'.phtml')) {
    		//Control output buffer to get the include contents
    		ob_start(); {
	    		include $templateFile;
		    	$r = ob_get_contents();
    		} ob_end_clean();
    	}
    	return $r;
    }
    public function __set($i, $v)
    {
    	if (!$this->_hasVisibleProperty($i)) throw new Base_Exception('Not allowed to change private or protected property');
    	$this->_outputVars[$i] = $v;
    }
    public function __get($i)
    {
        if (!$this->_hasVisibleProperty($i)) throw new Base_Exception('Not allowed to get values from private or protected properties');
    	return $this->_outputVars[$i];
    }
}

?>
